package routers

import (
	"github.com/kataras/iris/mvc"
	"lottery/bootstrap"
	"lottery/services"
	"lottery/web/controllers"
)

func Configure(b *bootstrap.Bootstrapper) {
	awardService := services.NewAwardService()
	eventService := services.NewEventService()
	resultService := services.NewResultService()
	userService := services.NewUserService()

	index := mvc.New(b.Party("/"))
	index.Register(userService)
	index.Handle(new(controllers.IndexController))

	events := mvc.New(b.Party("/events"))
	events.Register(
		awardService,
		eventService,
		resultService,
		userService)
	events.Handle(new(controllers.EventsController))

	play := mvc.New(b.Party("/play"))
	play.Register(
		awardService,
		eventService,
		resultService,
		userService)
	play.Handle(new(controllers.PlayController))

	results := mvc.New(b.Party("/results"))
	results.Register(
		awardService,
		eventService,
		resultService,
		userService)
	results.Handle(new(controllers.ResultController))
}
